package com.ybf.api.mapper;

import com.ybf.api.entity.Permissions;
import com.ybf.api.mapper.provider.PermissionsProvider;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ybf
 * @since 2024-09-26
 */
@Mapper
public interface PermissionsMapper {

    @SelectProvider(type = PermissionsProvider.class, method = "findAll")
    List<Permissions> list(@Param("permissions") Permissions permissions);

    @Delete("delete from permissions where id = #{id}")
    Integer delete(@Param("id") Integer id);

    @Select("select  from permissions where id = #{id}")
    Permissions info(@Param("id") Integer id);


    @Insert("insert into permissions (status) values (#{permissions.status})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    Integer add(@Param("permissions") Permissions permissions);

    @Update("update permissions set status = '#{permissions.status}' where id = #{permissions.id}")
    Integer edit(@Param("permissions") Permissions permissions);
}